package common

import (
	"context"
	"mini-app/internal/app/grpc/client"
	"mini-app/internal/app/grpc/protoc/devicec"
)

// GetLocationName 获取位置名称
func (GRPC) GetLocationName(ctx context.Context, locationIDs []string) map[string]string {
	cli, err := client.GetAdminClient()
	if cli != nil && err == nil {
		rsp, err := cli.LocationName(ctx, &devicec.LocationNameReq{
			LocationIds: locationIDs,
		})
		if err == nil && rsp.LocationNameMap != nil {
			return rsp.LocationNameMap
		}
	}
	return make(map[string]string)
}
